package com.lyl.redis.modules.dto;

import com.lyl.redis.modules.validation.group.Insert;
import com.lyl.redis.modules.validation.group.Update;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
public class ManagementAccountDTO {
    /**
     * 主键id
     */
    @NotNull(message = "id不能为空", groups = Update.class)
    private Long id;

    /**
     * 资方账号
     */
    @NotBlank(message = "账号不能为空", groups = Insert.class)
    private String account;

    /**
     * 资方密码
     */
    @NotBlank(message = "密码不能为空", groups = Insert.class)
    @Length(min = 6, message = "密码最少6个字符", groups = Insert.class)
    private String password;

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空", groups = Insert.class)
    @Length(max = 20, message = "用户名最长不能超过20个字符", groups = Insert.class)
    private String username;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号码不能为空", groups = Insert.class)
    @Pattern(regexp = "^((110)|(13[0-9])|(14[5,6,7,9])|(15[^4])|(16[0-9])|(18[0-9])|(17[0-8])|(19[0|1|2|3|5|6|7|8|9]))\\d{8}$",
            message = "手机号格式不正确", groups = Insert.class)
    private String phone;

    /**
     * 性别
     */
    @NotNull(message = "性别不能为空", groups = Insert.class)
    private Integer sex;
}
